package com.seari.bean;

import java.util.concurrent.Delayed;
import java.util.concurrent.TimeUnit;

public class BaseTaskBeans implements Delayed{
	

	private String command;
	
	private long startUpTime;
	
	private int everyDay;
	
	private String taskName;
	
	
	
	public String getTaskName() {
		return taskName;
	}
	public void setTaskName(String taskName) {
		this.taskName = taskName;
	}
	public String getCommand() {
		return command;
	}
	public void setCommand(String command) {
		this.command = command;
	}
	public long getStartUpTime() {
		return startUpTime;
	}
	public void setStartUpTime(long startUpTime) {
		this.startUpTime = startUpTime;
	}
	public int getEveryDay() {
		return everyDay;
	}
	public void setEveryDay(int everyDay) {
		this.everyDay = everyDay;
	}
	
	@Override
	public int compareTo(Delayed delay) {
		if(this.getDelay(TimeUnit.MILLISECONDS) < delay.getDelay(TimeUnit.MILLISECONDS)) {
			return -1;
		}
		if(this.getDelay(TimeUnit.MILLISECONDS) > delay.getDelay(TimeUnit.MILLISECONDS)) {
			return 1;
		}
		return 0;
	}
	
	@Override
	public long getDelay(TimeUnit unit) {
		return unit.convert((startUpTime - System.currentTimeMillis()),TimeUnit.MILLISECONDS);
	}
	

	
}
